UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gPfsE5GtOvVQYR16UgISBccnfWbReK1zv4ulzgy3JGk='
WHERE
key_id = 'd61bfbad4f2c63ffcb0e7ee96d8b92d629c4ae961479ed112ae6f868259dd43d'
AND (
token = 'gPfsE5GtOvVQYR16UgISBccnfWbReK1zv4ulzgy3JGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)