UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uER8WoFQV9KZQvZpVL0EiAQu3rq52DXFrdyqnq/nYT4=' 
WHERE 
  key_id = '8219556b9130a06d8991f8dc14a1cf528b820b809599178133b4f0560f26857d' 
  AND (
    token = 'uER8WoFQV9KZQvZpVL0EiAQu3rq52DXFrdyqnq/nYT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030