UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pj5Srg6ZVgTIWhxTPYI1+bGLkD4+63AQEh9X4POXfdI='
WHERE
key_id = 'e6a8ef7ab319237acb8c61b6fc412c792c7254a4e772f7889c7752af25569922'
AND (
token = 'pj5Srg6ZVgTIWhxTPYI1+bGLkD4+63AQEh9X4POXfdI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)