UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gy71dA4uNlqaFU0nHnNwBrr3E55U/csCWVqjgutzMgQ=' 
WHERE 
  key_id = 'fced3904fca125101a21203fd68772bd884ca94cdfa0858312892958d65e9d4a' 
  AND (
    token = 'gy71dA4uNlqaFU0nHnNwBrr3E55U/csCWVqjgutzMgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034