UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sSQfLJjGCxK2LGRuXgoXnPffuU9p+thIIaIIipPlyi8=' 
WHERE 
  key_id = 'ba7c577023ef7122d1d770ed5ebd5b88bc29b7e954f64c7fc581c082ca75a312' 
  AND (
    token = 'sSQfLJjGCxK2LGRuXgoXnPffuU9p+thIIaIIipPlyi8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033