UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd7LckTvzkpEVxcqfN+xcDxIs7EyiVGHrgcZEBT0WNok='
WHERE
key_id = '33bc40a4de1bddc4ba246fdcaea161644e4af0e281a6ba851691a32f2179220c'
AND (
token = 'd7LckTvzkpEVxcqfN+xcDxIs7EyiVGHrgcZEBT0WNok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)