UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cL3Hu2Qp1vRNo/0HQHl5nqx0ROnspaRNp4a6+6nqWeQ=' 
WHERE 
  key_id = '12dad4f57317eb00316e6cce76f70389c9fd92100a2a56776afa925d47db1cae' 
  AND (
    token = 'cL3Hu2Qp1vRNo/0HQHl5nqx0ROnspaRNp4a6+6nqWeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033