UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NGkg/znh56qH1MQZqRZA+slaQIVrzyrh1AcVDWU51ms=' 
WHERE 
  key_id = 'd2e63983db79389f10fd07ebab99a5786f387679d7f2fc01e7ed9f27678c65e5' 
  AND (
    token = 'NGkg/znh56qH1MQZqRZA+slaQIVrzyrh1AcVDWU51ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041