UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dmEHZ9JMKNdDcr9RtDjD4X6hsGpRm+c+KVYrok0f7Vw=' 
WHERE 
  key_id = '6e38cf59cf227518d0fcf373be4cfaaf324392ed1b09acba80be128e74bf1806' 
  AND (
    token = 'dmEHZ9JMKNdDcr9RtDjD4X6hsGpRm+c+KVYrok0f7Vw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036