UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50oGwfROSM3ITsqem+53RGVEmQaxTvpgWbXggomSyM8='
WHERE
key_id = '5f125701ab0c7f24140a3008b922c0375d06276eb5707f977ae9aa3b057a2479'
AND (
token = '50oGwfROSM3ITsqem+53RGVEmQaxTvpgWbXggomSyM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)