UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ecSb+M32DbE+CZ6VMHlXN2Gy2AKTpAgAEsKq9oTu2D4=' 
WHERE 
  key_id = '7a71934f09f4fabece59c00f80be9399e05e42d0167f9bd0c0d0af56bf8a2dca' 
  AND (
    token = 'ecSb+M32DbE+CZ6VMHlXN2Gy2AKTpAgAEsKq9oTu2D4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048