UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'byz5GO5/nGeH+A8T+Uo6lxVBDYnOUrH6frjRXHgMJcY=' 
WHERE 
  key_id = '1854b246b53328fc1b6c41b7102f0470038dba70b8b6a3aef87cce5844923420' 
  AND (
    token = 'byz5GO5/nGeH+A8T+Uo6lxVBDYnOUrH6frjRXHgMJcY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033