UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xc5OqK6PYMLcGUeaZvja7ThK3GvjsSbWHeg5Y4yydiM='
WHERE
key_id = '2b4d1fd576b51d68b154a6d95eb5164fdb863cc5b388cbaf1f9a3033a9ed7d3c'
AND (
token = 'xc5OqK6PYMLcGUeaZvja7ThK3GvjsSbWHeg5Y4yydiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)