UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+QXNQweZe/D028uHMBm+dBR1Y7I3asffCG7DAeHOfk=' 
WHERE 
  key_id = 'a5fe5515a86089e915426a9165da0715f58161089288f2cdcb26935fda3a2236' 
  AND (
    token = 'B+QXNQweZe/D028uHMBm+dBR1Y7I3asffCG7DAeHOfk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025