UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xhYID4mUecpx+xuSZp5MRVVD4d5bJzvh81RsyghMA34=' 
WHERE 
  key_id = '219afc349b0553081185e65117721c62bd6b975d063e05f793700d3dcf63c960' 
  AND (
    token = 'xhYID4mUecpx+xuSZp5MRVVD4d5bJzvh81RsyghMA34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019