UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KjegEusTFZe1YeHQxVYG9uDsXh3EZOhrdRKgj1iponQ=' 
WHERE 
  key_id = '9213d666a81086701152745901b0437a7ec33f9387dc3361a842878ca0336793' 
  AND (
    token = 'KjegEusTFZe1YeHQxVYG9uDsXh3EZOhrdRKgj1iponQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034