UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ps+8l2uo+Vhngv8xc0LnTw70QIXO87+0b2VodQamkCk='
WHERE
key_id = '133b20fa5bac9d331e5252fcb545528d287e104f8ff805d123f54ef9d055661b'
AND (
token = 'ps+8l2uo+Vhngv8xc0LnTw70QIXO87+0b2VodQamkCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)