UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I0NZFFd0m65tBowtFVlqgcvN1JmR+lYMEQAlP1XJEN4='
WHERE
key_id = 'b8cfd58a78bb9878e721799ea490615f4723ecb256905398a61e63894ae37614'
AND (
token = 'I0NZFFd0m65tBowtFVlqgcvN1JmR+lYMEQAlP1XJEN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)