UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9BYPWkD6B8kqHP5CjfymKjp+SUUDBUlQgvFOVRxH4Us=' 
WHERE 
  key_id = '6722f5e8bdebdb30e3a6b1c0a54db5ce5c67f7a0f091c12c1aed992c39afbd63' 
  AND (
    token = '9BYPWkD6B8kqHP5CjfymKjp+SUUDBUlQgvFOVRxH4Us=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052