UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fOSs3Huf+T7U3xOOv2jx6q9EdckHJthmd64DuEz9VOA=' 
WHERE 
  key_id = 'ff1cf92734f12001677e1f817f29177bd184786b6d1537a1fdbc501fb2362be3' 
  AND (
    token = 'fOSs3Huf+T7U3xOOv2jx6q9EdckHJthmd64DuEz9VOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034