UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aa6K9e5XQUURZytW2XM6zmp8+/gHv3QBB1vXIkcROYg=' 
WHERE 
  key_id = 'db386937e97f7fea597c4307ef3f303acc5a1059eab82762c4d0460043e43979' 
  AND (
    token = 'aa6K9e5XQUURZytW2XM6zmp8+/gHv3QBB1vXIkcROYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035