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