UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LC4J125rUeczMWwXpUwqZnI+cxWVV7VHrRi7WT579AM=' 
WHERE 
  key_id = 'c2f5e5e7de5bac992ac6f6a9d1e11305820d30676fea063c249fa58c69663362' 
  AND (
    token = 'LC4J125rUeczMWwXpUwqZnI+cxWVV7VHrRi7WT579AM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020