UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BNVak6Y736gf1DzOW//ynT67A0SgPD6QHsuxycVa304=' 
WHERE 
  key_id = 'e7ef61c7d809c0987c70f7be9806d92bee08dfaf0cf7af6091831bada440dfcd' 
  AND (
    token = 'BNVak6Y736gf1DzOW//ynT67A0SgPD6QHsuxycVa304=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045