UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mc+8QquqhZscn+wkEnNgOcpHvFAvhOcEzu9tCVil8ns=' 
WHERE 
  key_id = 'aaa21e390ddc6ddb5c4dc4d3067e42c0b3b2da25bb3846bf304e31c77538bb8e' 
  AND (
    token = 'Mc+8QquqhZscn+wkEnNgOcpHvFAvhOcEzu9tCVil8ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030