UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mLpMS4/61/mmzsTngXoNtCKNsOvHCj+6yY1IIzBqVTg='
WHERE
key_id = '27ce3062bfac4c2120de67d415c9ab8a5346afbd17de38801cafb5c204488abc'
AND (
token = 'mLpMS4/61/mmzsTngXoNtCKNsOvHCj+6yY1IIzBqVTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)