UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BYPHK7LaPKvcg87BPnZvmNwWHxe/mYaNpqSOPXu7/r8='
WHERE
key_id = 'a6e4cf20420c9498a63f1eebe974e3aafa6949c36de6399797bffd2a6120aa6e'
AND (
token = 'BYPHK7LaPKvcg87BPnZvmNwWHxe/mYaNpqSOPXu7/r8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)