UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i4EBTBaFDPGSHMri3fczTEaH6Bpc3GZIT5nc/hiQ014=' 
WHERE 
  key_id = '6aff7c25c36cfa98c38912427910f6b75fdd61164ecfffb42a661c2850bb017d' 
  AND (
    token = 'i4EBTBaFDPGSHMri3fczTEaH6Bpc3GZIT5nc/hiQ014=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024