UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wWI5fw1uWQNBM3jB0cj4xEcudCAObrdBkoTZw7CHwog='
WHERE
key_id = '9b0f6728e8982da658f9a7a817fa87835f20295712d0b19af5636c7131019ec0'
AND (
token = 'wWI5fw1uWQNBM3jB0cj4xEcudCAObrdBkoTZw7CHwog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)